﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models.Common
{
    public class GpioCommandEnum
    {
        /// <summary>
        /// 开
        /// </summary>
        public static string OPEN = "open";
        /// <summary>
        /// 关
        /// </summary>
        public static string CLOSE = "close";


        /// <summary>
        /// 查状态
        /// </summary>
        public static string CHECK_STATE = "check_state";

        /// <summary>
        /// 返回状态 开  针对wifi带回传功能的继电器，返回的return_open 指令 跟上面 open的指令不一样，所以单独设置了 返回 开 状态，而不共用上面的open
        /// </summary>
        public static string RETURN_OPEN = "return_open";
        /// <summary>
        /// 返回状态 关 针对wifi带回传功能的继电器
        /// </summary>
        public static string RETURN_CLOSE = "return_close";
        /// <summary>
        /// 异常
        /// </summary>
        public static string RETURN_ERROR = "return_error";

        /// <summary>
        /// ok
        /// </summary>
        public static string RETURN_OK = "return_ok";


        /// <summary>
        /// 风扇返回状态
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static int getFanReturnStatus(string msg)
        {
            if (msg == RETURN_OPEN || msg == EnumDeviceState.Gpio_Live_State.open.ToString())
            {
                //正常
                return (int)EnumDeviceState.Gpio_Live_State.open;
            }
            else if (msg == RETURN_CLOSE || msg == EnumDeviceState.Gpio_Live_State.close.ToString())
            {
                //正常
                return (int)EnumDeviceState.Gpio_Live_State.close;
            }
            return (int)EnumDeviceState.Gpio_Live_State.error;
        }

    }
}
